package com.fc.advbox.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fc.advbox.utils.validator.group.AddGroup;
import com.fc.advbox.utils.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * ContractEntity
 *
 * @author Gary.Jiang
 * @date 2018/6/22.15:40
 */

@Getter
@Setter
@ToString
@JsonSerialize
@ApiModel(value = "ContractEntity", description = "合同对象")
public class ContractEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;

    @ApiModelProperty(value = "JIA_ORG_ID")
//    @NotNull(message="甲方机构Id不能为空",  groups = {AddGroup.class, UpdateGroup.class})
    private Long jiaOrgId;

    @ApiModelProperty(value = "YI_ORG_ID")
    @NotNull(message="乙方机构Id不能为空",  groups = {AddGroup.class, UpdateGroup.class})
    private Long yiOrgId;

    @ApiModelProperty(value = "name")
//    @NotBlank(message="合同名不能为空",  groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @ApiModelProperty(value = "PROVINCE")
    @NotBlank(message="省份不能为空",  groups = {AddGroup.class, UpdateGroup.class})
    private String province;

    @ApiModelProperty(value = "CITY")
    @NotBlank(message="城市不能为空",  groups = {AddGroup.class, UpdateGroup.class})
    private String city;

    @ApiModelProperty(value = "AREA", allowEmptyValue = true)
    private String area;

    @ApiModelProperty(value = "CONTACTOR", allowEmptyValue = true)
    private String contactor; //联系人

    @ApiModelProperty(value = "CONTACT_PHONE", allowEmptyValue = true)
    private String contactPhone; //联系人电话

    @ApiModelProperty(value = "descn", allowEmptyValue = true)
    private String descn;

    @ApiModelProperty(value = "TYPE", notes = "AGENT:代理合同，CHANNEL:渠道合同，RENT：广告商租赁合同", allowEmptyValue = true)
    private String type; //AGENT:代理合同，CHANNEL:渠道合同，RENT：广告商租赁合同

    @ApiModelProperty(value = "EQUIPMENT_NUM", allowEmptyValue = true)
    @Min(message = "设备数量不能为0", value=1)
    private Integer equipmentNum;

    @ApiModelProperty(value = "AGENT_AMOUNT", notes = "代理费", allowEmptyValue = true)
    private BigDecimal agentAmount; //代理费

    @ApiModelProperty(value = "RETURN_AMOUNT", notes = "单台机器落地安装返利", allowEmptyValue = true)
    private BigDecimal returnAmount; //单台机器落地安装返利

    @ApiModelProperty(value = "BENIFIT_RATE", notes = "利润占比", allowEmptyValue = true)
    private BigDecimal benifitRate; //利润占比

    @ApiModelProperty(value = "amount", allowEmptyValue = true)
    private BigDecimal amount;

    @ApiModelProperty(value = "START_DATE", allowEmptyValue = true)
    @NotNull(message = "合同起始时间不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Date startDate;

    @ApiModelProperty(value = "END_DATE", allowEmptyValue = true)
    @NotNull(message = "合同截至时间不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Date endDate;

    private transient Integer interva;
    private transient String jiaOrgName;
    private transient String yiOrgName;

    @ApiModelProperty(value = "status", notes = "合同状态 （drafting -- 草稿,保存   confirmed -- 合同已确定  termination -- 终止）", allowEmptyValue = true)
    private String status; // drafting -- 草稿,保存   confirmed -- 合同已确定

    @ApiModelProperty(value = "equipmentIds", notes = "合同涉及的设备ID, List, 例如 {1,2,3}", allowEmptyValue = true)
    private List<Long> equipmentIds;
}
